package cn.iocoder.yudao.module.api.infrastructure.config.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Positive;
import jakarta.validation.constraints.PositiveOrZero;
import lombok.Data;

import java.util.List;

/**
 * 广告投放配置信息 Response DTO
 *
 * @author 山野羡民
 */
@Data
public class AdConfigRespDTO {

    @Schema(description = "广告投放说明")
    private String tips;

    @Schema(description = "曝光 1 次需要多少分钱")
    @PositiveOrZero
    private int exposureUnitPrice;

    @Schema(description = "播放广告视频 1 次不得少于多少秒")
    @Positive
    private int playMinSeconds;

    @Schema(description = "播放 1 次需要多少分钱")
    @PositiveOrZero
    private int playUnitPrice;

    @Schema(description = "最低预算金额，单位为分")
    @Positive
    private int minBudgetAmount;

    @Schema(description = "广告投放预设金额，单位为分")
    private List<Integer> presetAmounts;

    @SuppressWarnings("unused")
    public List<Integer> getPresetAmounts() {
        if (presetAmounts == null) {
            return List.of(minBudgetAmount);
        }
        presetAmounts.add(minBudgetAmount);
        return presetAmounts.stream().distinct().sorted().toList();
    }

    @Schema(description = "每日做任务来增值联盟豆需要播放多少个广告视频")
    @Positive
    private int dailyTaskAdCount;

}
